{% extends 'base.html' %}
{% block head %}
	<link href="{{ path }}js/plugins/datatables/DT_bootstrap.css" rel="stylesheet">
	<link href="{{ path }}js/plugins/responsive-tables/responsive-tables.css" rel="stylesheet"> 
    
    <script src="{{ path }}js/demos/demo.tables.js"></script>
    <script src="{{ path }}js/plugins/datatables/jquery.dataTables.js"></script>
    <script src="{{ path }}js/plugins/datatables/DT_bootstrap.js"></script>
	<script src="{{ path }}js/plugins/responsive-tables/responsive-tables.js"></script>

{% endblock %}
{% load humanize %}
{% block jquery %}	

{% endblock %}

{% block javascript %}
    function eliminar(factura_id){
            $.ajax({
              url: "/contabilidad/recibo-caja/borrar/",
              type: "POST",
              data : {recibo_id:factura_id, 
                       },
              dataType: "html",
              success: function(datos) {
                    if(datos==1){
                        location.reload(true);
                    }
                    else{
                        alert("Se ha producido un error borrando el recibo." + datos);
                    }
                  
              }
          });
        return false;
    }
{% endblock %}

{% block contenido %}
	{{ request.session.control }}
    	
		<div class="span12">
            <div class="widget">	
                <div class="widget widget-table">   
                    <div class="widget-header">						
                        <h3>
                            <i class="icon-th-list"></i>
                            Recibos de caja
                        </h3>
                    </div> <!-- /widget-header -->
                    <form id="frm_borrar" action="/contabilidad/recibo-caja/borrar/" method="post">
                    <div class="widget-content">
                        {% csrf_token %}
                        <table class="table table-striped table-bordered table-highlight" id="example">
                            <thead>
                            <tr>
                                <th width="10%" align="center">No.</th>
                                <th width="15%" align="center">Fecha</th>
                                <th width="30%" align="center">Recibido de</th>
                                <th width="15%" align="center">Nit / CC</th>
                                <th width="20%" align="center">Valor</th>
                                <th width="5%" align="center">Editar</th>
                                <th width="5%" align="center">Borrar</th>
                            </tr>
                            </thead>
                            <tbody>
                            {% for recibo in Recibos %}
                                <tr class="{% cycle '' 'odd' %}">
                                    <td align="right"><label>{{ recibo.consecutivo }}</label></td>
                                    <td align="center"><label>{{ recibo.fecha|date:'d-m-Y' }}</label></td>
                                    <td align="left"><label>{{ recibo.estudiante }}</label></td>
                                    <td align="left"><label>{{ recibo.estudiante.identificacion }}</label></td>
                                    <td align="right"><label>{{ recibo.debito|intcomma }}</label></td>
                                    <td><a href="/contabilidad/recibo-caja/buscar/{{recibo.id}}/" id="rec_{{ recibo.id }}" data-toggle="modal" class="acc_recibo"><img src="{{ path }}images/24x24/edit.png" /></a></td>
                                    <td><a href="#"><img src="{{ path }}images/delete.png" width="16" height="16" alt="Eliminar" onclick="if(confirm('¿Desea eliminar el recibo?')){eliminar({{ recibo.id }});}"/></a></td>
                                </tr>
                            {% endfor %}
                            </tbody>
                        </table>
                    </div> <!-- /. widget-content -->
                    <div class="modal-footer">
                    	<!--<button type="submit" id="btn_eliminar" class="btn btn-medium">Eliminar</button>-->
                        <a href="/contabilidad/recibo-caja/nuevo" data-toggle="modal" class="btn btn-primary btn-medium">Nuevo</a>
                    </div>
                    </form>
                </div> <!-- /. widget-table -->
            </div> <!-- /. widget -->
        </div> <!-- /. span12 -->
{% endblock %}